﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Web;
using CrystalDecisions.Windows;


namespace QLThuoc_report
{
    public partial class frm_NhanVien : Form
    {
        public frm_NhanVien()
        {
            InitializeComponent();
        }

        private void frm_NhanVien_Load(object sender, EventArgs e)
        {
           SqlConnection conn = new SqlConnection("Data Source =(local);Initial Catalog=QLThuoc;Integrated Security=true");
            SqlDataAdapter da = new SqlDataAdapter("SELECT     dbo.tbl_NhanVien.MaNV AS [Mã Nhân Viên], dbo.tbl_NhanVien.HoTen AS [Họ Tên], dbo.tbl_NhanVien.NgaySinh AS [Ngày Sinh], dbo.tbl_NhanVien.GioiTinh AS [Giới Tính], dbo.tbl_NhanVien.CMT AS [Chứng Minh Thư], dbo.tbl_NhanVien.DiaChi AS [Địa Chỉ], dbo.tbl_NhanVien.DienThoai AS [Điện Thoại], dbo.tbl_NhanVien.Email,     dbo.tbl_NhomQuyen.TenNQ AS [Nhóm Quyền], dbo.tbl_NhanVien.TenDangNhap AS [Tên Đăng Nhập], dbo.tbl_NhanVien.MatKhau AS [Mật Khẩu] FROM         dbo.tbl_NhanVien INNER JOIN   dbo.tbl_NhomQuyen ON dbo.tbl_NhanVien.MaNQ = dbo.tbl_NhomQuyen.MaNQ", conn);
            DataTable dt = new DataTable();
            da.Fill(dt);
            //lay duong dan du chuy?n sang máy tính nào c?ng ko b? l?i, ko có c?ng ðc nhýng sang máy tính khác s? ko ch?y ðc
            string path = Application.StartupPath;
            path = path.Substring(0, path.LastIndexOf("bin")) + "HSnhanvien.rpt";
            HSnhanvien report = new HSnhanvien();
            report.SetDataSource(dt);
            crystalReportViewer1.ReportSource = report;
        }
    }
}
